<?php
function language_filter($content)
{
   if (  ( isset($_GET['lang']) && $_GET['lang'] == 'en' ) || ( isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) && $_SERVER['HTTP_ACCEPT_LANGUAGE'] == 'en' ) )
   {
    $del_lang = 'fr';
      $use_lang = 'en';
     
   }
   else
   {
      $del_lang = 'en';
      $use_lang = 'fr';
   }
   $content = preg_replace('`<' . $del_lang . '>(.*?)</' . $del_lang . '>`s', '', $content);
   $content = preg_replace('`<' . $use_lang . '>(.*?)</' . $use_lang . '>`s', '$1', $content);
   return $content;
}
ob_start('language_filter');

if(isset($_GET['lang'])){
$lang=$_GET['lang'];
$recupUrlComplet=$_SERVER['REQUEST_URI'];
$URLS=explode("?", $recupUrlComplet); 
$recupUrl=substr($recupUrlComplet, 0, -8);
}
if(!isset($_GET['lang'])){
$lang="fr";
$recupUrlComplet=$_SERVER['REQUEST_URI'];
/*$URLS=explode("?", $recupUrlComplet); 
$recupUrl=substr($URLS[0], 0, 0)."";*/
$recupUrl=$recupUrlComplet;
}
?>